<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>请稍后</title>
    <link rel="StyleSheet" href="public/assets/base.css?ver=${version}" type="text/css" />
    <link rel="StyleSheet" href="public/assets/icon-font.css?ver=${version}" type="text/css" />
    <link rel="StyleSheet" href="${ui_css_path}?ver=${version}" type="text/css" />
    <link rel="StyleSheet" href="${page_css_path}?ver=${version}" type="text/css" />
</head>
<body>
    <div class="loading-gate hidden"></div>
    <div class="loading-bar hidden"><span></span></div>
<div class="page-top">
    <div class="top"></div>
    <div class="logo">
        <img src="${logo}" alt="logo" height="60"/>
    </div>
    <a href="javascript:;" class="logo hidden">
        <h1 class="hidden" field="sysName">-</h1>
    </a>
    <div class="page-user">
        <img field="userAvatar" class="avatar"/>
        <div class="text">
            <span field="dateStr"></span><br/>
            欢迎您：<span class="username" field="userName"></span>&nbsp;&nbsp; |&nbsp;&nbsp;
            <a href="javascript:void(0)" onclick="FwTab.show('修改用户资料', '?module=user&amp;action=saveProfile', true);">修改密码</a>&nbsp;|&nbsp;
            <a href="javascript:;" id="btn_logout" title="安全退出系统">退出</a>
        </div>
    </div>

    <div class="top-ctrl">
        <div class="site-selector hidden" id="site-selector">
            <select>
                <option value="">一选择站点一</option>
            </select>
        </div>
        <ul class="icon-ctrl">
            <li class="first">
                <span class="icon-wrap1">
                    <a class="title" href="javascript:FwMenu.change('site');">
                        <img class="icon" src="/public/mui/css/latest/icon_user.png" height="20" />网站管理
                    </a>
                </span>
            </li>

            <li>
                <span class="icon-wrap1">
                    <a class="title" href="javascript:FwMenu.change('content');">
                        <img class="icon" src="/public/mui/css/latest/icon_chart.png" height="20" />内容管理
                    </a>
                </span>
            </li>

            <li>
                <span class="icon-wrap1">
                    <a class="title" href="javascript:FwMenu.change('system');">
                        <img class="icon" src="/public/mui/css/latest/icon_config.png" height="20" />系统管理
                    </a>
                </span>
            </li>
            <!--
            <li><a href="javascript:;" class="drop"><img class="icon" src="/public/mui/css/latest/icon_config.png" height="20"/>权限管理</a></li>
            <li><a href="javascript:;" class="drop"><img class="icon" src="/public/mui/css/latest/icon_user.png" height="20"/>人员管理</a></li>-->
        </ul>
    </div>


    <div class="clearfix"></div>
</div>

<div class="page-main">
    <div class="page-main-right" id="page-main-right">
        <div id="pagetabs" class="page-tabs">
            <ul> </ul>
            <div class="clearfix"></div>
        </div>
        <div style="height: 0px; overflow: hidden; clear: both; display: none;">针对IE7优化</div>
        <div class="page-frames" id="pageframes">
            <div class="frames"></div>
            <div class="page-frame-shadow hidden">这是为支持分列右侧拖动</div>
        </div>
    </div>

    <div class="page-main-left" id="page-main-left">
        <div class="page-left-menu"></div>
    </div>

    <div id="page-main-split" class="page-main-split" min="120" max="600"></div>
</div>


$js()

<script type="text/javascript">
    window._path = '${admin_path}';
    window._siteId = '${site_id}';
    window._localJs = '${local_js}';
</script>
<script type="text/javascript" src="public/mui/js/component.js?v=${version}"></script>
<script type="text/javascript">
    var pageVar = {
        sysName: ':: 控制面板中心管理端 一 JR Cms .NET! v${version} ::',
        sysLogo: '',
        dateStr: '2014-10-15',
        firstTabName: '欢迎首页',
        firstIframeUrl: '${entryFrameUrl}',
        userName: '管理员',
        userAvatar: '/public/mui/css/latest/avatar.gif'
    };

    if (window._localJs) {
        jr.ldScript(window._localJs);
    }

    /** 获取时间 **/
    var cmath = function(v) {
        return v < 10 ? '0' + v : v;
    };

    function getDate(dt) {
        if (!dt) {
            dt = new Date();
        }
        var chWeekNames = ['日', '一', '二', '三', '四', '五', '六'];
        return cmath(dt.getFullYear()) + '年' + cmath(dt.getMonth() + 1) + '月' + cmath(dt.getDate()) + '日&nbsp;/&nbsp;周' +
            chWeekNames[dt.getDay()];
        /*+ '&nbsp;' + cmath(dt.getHours()) + ':' + cmath(dt.getMinutes()) + ':' + cmath(dt.getSeconds());*/
    };

    pageVar.dateStr = getDate();
    document.title = pageVar.sysName;
    jr.json.bind(document, pageVar);

  
    var siteEle = jr.$fn('.site-selector');

    //初始化站点
    function initSites() {
        if (window.sites.length > 1) {
            siteEle.removeClass("hidden");
            var siteSel = siteEle.find('SELECT');
            for (var i = 0; i< window.sites.length;i++) {
                var site = window.sites[i];
                var opt = document.createElement('OPTION');
                opt.value = site.id;
                opt.innerHTML = site.name;
                siteSel.append(opt);
            }
            siteSel.val(window._siteId);
            siteSel.change(function() {
                var siteId = this.val();
                if (siteId)setSite(this.val());
            });
        }
    }

    function setSite(t) {
        var id = t;
        if (t.nodeName) id = t.getAttribute('siteId');
        jr.xhr.get(window._path + '?module=system&action=selectSite&json=1&site_id=' + id, function() {
            location.replace(location.href);
        });
    }


    //初始化站点
    var timer = setInterval(function() {
        if (window.menuData != null) {
            clearInterval(timer);
            //window.M.loadCatTree();
            // menu_init();
            FwMenu.init(window.menuData, window.menuHandler);
            FwMenu.change();


            //加载栏目树
            _loadCategoryTree();

            //初始化站点
            initSites();

            /// $$('username').innerHTML = username;
            // jr.$('groupname').innerHTML = groupname;

            //var ifr = jr.$('ifr_first');
            //ifr.src = ifr.getAttribute('ref');

            //loadApps();
        }
    }, 100);

    FwTab.showLoadBar = showGate;
    FwTab.hiddenLoadBar = cancelGate;

    jr.event.add(window, 'load', function() {
        jr.event.add(jr.$('btn_logout'), 'click', function() {
            if (confirm('请确认您已经操作完毕并做好数据保存工作！确定继续吗？')) {
                location.replace('?module=system&action=logout');
            }
        });

        FwTab.show(pageVar.firstTabName, pageVar.firstIframeUrl, false);
       
    });

</script>
</body>
</html>
